cmake_minimum_required(VERSION 3.15.0)
file(GLOB_RECURSE srcs CONFIGURE_DEPENDS src/*.cpp include/*.hpp)
project(example VERSION 0.1.0 LANGUAGES C CXX)

add_executable(${PROJECT_NAME} ${srcs})
target_include_directories(${PROJECT_NAME} PUBLIC include)

target_link_libraries(${PROJECT_NAME} PUBLIC ${Vulkan_LIBRARIES} glfwKit vk-bootstrap::vk-bootstrap)

################ <option> ################
option(VK_BOOTSTRAP_WERROR ON)  # 在编译期间将警告作为错误启用。
option(VK_BOOTSTRAP_TEST ON)    # 启用在此项目中生成测试。如果启用，将自动下载GLFW和Catch2。
################ <option> ################


# 设置RPATH（运行时库搜索路径）
set_target_properties(${PROJECT_NAME} PROPERTIES
    OUTPUT_NAME ${PROJECT_NAME}
    INSTALL_RPATH "\${ORIGIN}/../lib"
)

# 安装规则
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
install(TARGETS glfwKit vk-bootstrap DESTINATION lib)
install(DIRECTORY ${ASSETS_SOURCE_FOLDER} DESTINATION .)

# 包括 CPack 打包配置
include(InstallRequiredSystemLibraries)
set(CPACK_RESOURCE_FILE_LICENSE ${NATIVERENDER_ROOT_PATH}/License.txt)
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
# set(CPACK_GENERATOR NSIS64)
set(CPACK_GENERATOR "ZIP")
set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
set(CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME}-${PROJECT_VERSION})
set(CPACK_PACKAGE_DIRECTORY ${NATIVERENDER_ROOT_PATH}/bin)
include(CPack)